/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.productLabel.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.productLabel.domain.ProductLabel;
import com.seeyoui.kensite.bussiness.orderlang.productLabel.persistence.ProductLabelMapper;

/**
 * ProductLabel
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-02-07
 */

@Service
public class ProductLabelService extends BaseService {
	
	@Autowired
	private ProductLabelMapper productLabelMapper;
	
	public void deleteByProductId(String productId){
		productLabelMapper.deleteByProductId(productId);
	}
	
	/**
	 * 根据产品id查询标签列表
	 * @param productId
	 * @return
	 */
	public List<ProductLabel> findlabelByProductId(String productId){
		return productLabelMapper.findlabelByProductId(productId);
	}
	
	/**
	 * 查询标签列表（去重）
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductLabel> findProductLabelListNoRepeat() throws CRUDException{
		return productLabelMapper.findProductLabelListNoRepeat();
	}

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public ProductLabel findOne(String id) throws CRUDException{
		return productLabelMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param productLabel
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductLabel> findList(ProductLabel productLabel) throws CRUDException {
		return productLabelMapper.findList(productLabel);
	}
	
	/**
	 * 查询所有数据集合
	 * @param productLabel
	 * @return
	 * @throws CRUDException
	 */
	public List<ProductLabel> findAll(ProductLabel productLabel) throws CRUDException {
		return productLabelMapper.findAll(productLabel);
	}
	
	/**
	 * 查询数据总数
	 * @param productLabel
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(ProductLabel productLabel) throws CRUDException {
		return productLabelMapper.findTotal(productLabel);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param productLabel
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(ProductLabel productLabel) throws CRUDException {
		return productLabelMapper.findExTotal(productLabel);
	}
	
	/**
	 * 数据新增
	 * @param productLabel
	 * @throws CRUDException
	 */
	public void save(ProductLabel productLabel) throws CRUDException{
		productLabel.preInsert();
		productLabelMapper.save(productLabel);
	}
	
	/**
	 * 数据修改
	 * @param productLabel
	 * @throws CRUDException
	 */
	public void update(ProductLabel productLabel) throws CRUDException{
		productLabel.preUpdate();
		productLabelMapper.update(productLabel);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		productLabelMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param productLabel
	 * @throws CRUDException
	 */
	public void remove(ProductLabel productLabel) throws CRUDException{
		productLabel.preUpdate();
		productLabelMapper.remove(productLabel);			
	}
	
}